package org.testis.gui.mvc.model.testdesign;

import org.testis.gui.mvc.model.*;
import org.testis.gui.mvc.controller.testdesign.ProfileSettingDetailsController;
import org.testis.gui.mvc.utilities.AtofProfileKeyTableModel;



/**
 *
 * @author nurhat
 */
public class ProfileSettingDetailsModel extends AbstractModel
{

    private Boolean m_viewVisibility = false;
    private AtofProfileKeyTableModel m_model;
    private String m_lastError;
    private Integer m_currentProfileId;
    private String m_keyName;
    private String m_keyValue;


    public ProfileSettingDetailsModel(AtofProfileKeyTableModel model)
    {
        super();
        setModel(model);
    }


    public Boolean getViewVisibility()
    {
        return m_viewVisibility;
    }


    public void setViewVisibility(Boolean val)
    {
        boolean oldValue = m_viewVisibility;
        m_viewVisibility = val;

        firePropertyChange(ProfileSettingDetailsController.SHOW_VIEW,
                           oldValue,
                           m_viewVisibility);
    }


    public AtofProfileKeyTableModel getModel()
    {
        if (m_model == null) {
            setModel(new AtofProfileKeyTableModel());
        }
        return m_model;
    }


    public void setModel(AtofProfileKeyTableModel model)
    {
        AtofProfileKeyTableModel oldModel = m_model;
        m_model = model;
        firePropertyChange(
            ProfileSettingDetailsController.PARAMETER_MODEL_CHANGED,
            oldModel,
            m_model);
    }


    public String getLastError()
    {
        return m_lastError;
    }


    public void setLastError(String val)
    {
        String oldValue = m_lastError;
        m_lastError = val;
        firePropertyChange(ProfileSettingDetailsController.SHOW_ERROR,
                           oldValue,
                           m_lastError);
    }


    public Integer getCurrentProfileId()
    {
        return m_currentProfileId;
    }


    public void setCurrentProfileId(Integer val)
    {
        Integer oldValue = m_currentProfileId;
        m_currentProfileId = val;
        firePropertyChange(ProfileSettingDetailsController.CURRENT_PROFILE_ID,
                           oldValue,
                           m_currentProfileId);
    }


    public String getKeyName()
    {
        return m_keyName;
    }


    public void setKeyName(String val)
    {
        String oldValue = m_keyName;
        this.m_keyName = val;
        firePropertyChange(
            ProfileSettingDetailsController.CURRENT_SELECTED_KEYNAME,
            oldValue,
            m_keyName);
    }


    public String getKeyValue()
    {
        return m_keyValue;
    }


    public void setKeyValue(String val)
    {
        String oldValue = m_keyValue;
        this.m_keyValue = val;
        firePropertyChange(
            ProfileSettingDetailsController.CURRENT_SELECTED_KEYVALUE,
            oldValue,
            m_keyValue);
    }
}
